<% layout('/layouts/default.html', {title: '到单押汇管理', libs: ['dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<div class="box-title">
				<i class="fa icon-notebook"></i> ${text('到单押汇管理')}
			</div>
			<div class="box-tools pull-right">
				<a href="#" class="btn btn-default" id="btnSearch" title="${text('查询')}"><i class="fa fa-filter"></i> ${text('查询')}</a>
<!--				<% if(hasPermi('financial:billnegotiated:billNegotiated:edit')){ %>-->
<!--					<a href="${ctx}/financial/billnegotiated/billNegotiated/form" class="btn btn-default btnTool" title="${text('新增到单押汇')}"><i class="fa fa-plus"></i> ${text('新增')}</a>-->
<!--				<% } %>-->
				<a href="#" class="btn btn-default" id="btnSetting" title="${text('设置')}"><i class="fa fa-navicon"></i></a>
			</div>
		</div>
		<div class="box-body">
			<#form:form id="searchForm" model="${billNegotiated}" action="${ctx}/financial/billnegotiated/billNegotiated/listData" method="post" class="form-inline hide"
					data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
				<div class="form-group">
					<label class="control-label">${text('车架号')}：</label>
					<div class="control-inline width-160">
						<#form:select path="frameNumber" items="${frameNumberList}"
						itemLabel="frameNumber" itemValue="frameNumber" blankOption="true" class="form-control"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('品牌')}：</label>
					<div class="control-inline width-120">
						<#form:select path="brand" dictType="car_pinpai" blankOption="true" class="form-control"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('版型')}：</label>
					<div class="control-inline width-120">
						<#form:select path="area" dictType="car_quyu" blankOption="true" class="form-control"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('币种')}：</label>
					<div class="control-inline width-120">
						<#form:select path="currency" dictType="sys_bizhong" blankOption="true" class="form-control"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('状态')}：</label>
					<div class="control-inline width-120">
						<#form:select path="status1" dictType="bill_negotiated_status" blankOption="true" class="form-control"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('编号')}：</label>
					<div class="control-inline">
						<#form:input path="billNegotiatedCode" maxlength="100" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('信用证')}：</label>
					<div class="control-inline">
						<#form:input path="letterCreditCode" maxlength="100" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('服务订单')}：</label>
					<div class="control-inline width-120">
						<#form:select path="serviceOrderCode" items="${listServiceOrder}"
						itemLabel="serviceOrderCode" itemValue="serviceOrderId" blankOption="true" class="form-control"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('委托协议')}：</label>
					<div class="control-inline">
						<#form:input path="entrustAgreement" maxlength="100" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('客户')}：</label>
					<div class="control-inline width-120">
						<#form:treeselect id="customer" title="${text('客户选择')}"
						path="customer.customerId" labelPath="customer.customerName"
						url="${ctx}/base/customer/customer/treeData" canSelectRoot="true" canSelectParent="true"
						class="" allowClear="true" />
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('资方')}：</label>
					<div class="control-inline width-120">
						<#form:select path="investorId" items="${gnzfList}" itemLabel="supplierName" itemValue="supplierId"
						class="form-control required" blankOption="true"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('外贸合同号')}：</label>
					<div class="control-inline">
						<#form:input path="foreignTradeContractNumber" maxlength="100" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('开始日期')}：</label>
					<div class="control-inline">
						<#form:input path="startDate_gte" readonly="true" maxlength="20" class="form-control laydate width-date"
							dataFormat="date" data-type="date" data-format="yyyy-MM-dd" data-done="startDate_lte.click()"/>
						&nbsp;-&nbsp;
						<#form:input path="startDate_lte" readonly="true" maxlength="20" class="form-control laydate width-date"
							dataFormat="date" data-type="date" data-format="yyyy-MM-dd"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('资方结束日期')}：</label>
					<div class="control-inline">
						<#form:input path="investorEndDate_gte" readonly="true" maxlength="20" class="form-control laydate width-date"
							dataFormat="date" data-type="date" data-format="yyyy-MM-dd" data-done="investorEndDate_lte.click()"/>
						&nbsp;-&nbsp;
						<#form:input path="investorEndDate_lte" readonly="true" maxlength="20" class="form-control laydate width-date"
							dataFormat="date" data-type="date" data-format="yyyy-MM-dd"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('客户结束日期')}：</label>
					<div class="control-inline">
						<#form:input path="customerEndDate_gte" readonly="true" maxlength="20" class="form-control laydate width-date"
							dataFormat="date" data-type="date" data-format="yyyy-MM-dd" data-done="customerEndDate_lte.click()"/>
						&nbsp;-&nbsp;
						<#form:input path="customerEndDate_lte" readonly="true" maxlength="20" class="form-control laydate width-date"
							dataFormat="date" data-type="date" data-format="yyyy-MM-dd"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('是否N+1')}：</label>
					<div class="control-inline width-120">
						<#form:select path="n1Flag" dictType="sys_yes_no" blankOption="true" class="form-control"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('实际还汇日期')}：</label>
					<div class="control-inline">
						<#form:input path="investorActualRepaymentDate_gte" readonly="true" maxlength="20" class="form-control laydate width-datetime"
							dataFormat="datetime" data-type="datetime" data-format="yyyy-MM-dd HH:mm" data-done="investorActualRepaymentDate_lte.click()"/>
						&nbsp;-&nbsp;
						<#form:input path="investorActualRepaymentDate_lte" readonly="true" maxlength="20" class="form-control laydate width-datetime"
							dataFormat="datetime" data-type="datetime" data-format="yyyy-MM-dd HH:mm"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('实际还汇日期')}：</label>
					<div class="control-inline">
						<#form:input path="customerActualRepaymentDate_gte" readonly="true" maxlength="20" class="form-control laydate width-date"
							dataFormat="date" data-type="date" data-format="yyyy-MM-dd" data-done="customerActualRepaymentDate_lte.click()"/>
						&nbsp;-&nbsp;
						<#form:input path="customerActualRepaymentDate_lte" readonly="true" maxlength="20" class="form-control laydate width-date"
							dataFormat="date" data-type="date" data-format="yyyy-MM-dd"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('创建者')}：</label>
					<div class="control-inline width-120">
						<#form:select path="createBy" items="${listUser}"
						itemLabel="userName" itemValue="userCode" blankOption="true" class="form-control" />
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('创建时间')}：</label>
					<div class="control-inline">
						<#form:input path="createDate_gte" readonly="true" maxlength="20" class="form-control laydate width-date"
							dataFormat="date" data-type="date" data-format="yyyy-MM-dd" data-done="createDate_lte.click()"/>
						&nbsp;-&nbsp;
						<#form:input path="createDate_lte" readonly="true" maxlength="20" class="form-control laydate width-date"
							dataFormat="date" data-type="date" data-format="yyyy-MM-dd"/>
					</div>
				</div>
				<div class="form-group">
					<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
					<button type="reset" class="btn btn-default btn-sm">${text('重置')}</button>
				</div>
			</#form:form>
			<table id="dataGrid"></table>
			<div id="dataGridPage"></div>
		</div>
	</div>
</div>
<% } %>
<script>
// 初始化DataGrid对象
$('#dataGrid').dataGrid({
	searchForm: $("#searchForm"),
	columnModel: [
		{header:'${text("编号")}', name:'billNegotiatedCode', index:'a.bill_negotiated_code', width:150, align:"left", frozen:true, formatter: function(val, obj, row, act){
				return '<a href="${ctx}/financial/billnegotiated/billNegotiated/detail?billNegotiatedId='+row.billNegotiatedId+'" class="btnList" data-title="${text("查看到单押汇")}">'+(val||row.id)+'</a>';
			}},
		{header:'${text("操作")}', name:'actions', width:80, sortable:false, title:false, formatter: function(val, obj, row, act){
            var actions = [];
            <% if(hasPermi('financial:billnegotiated:billNegotiated:view')){ %>
            actions.push('<a href="${ctx}/financial/billnegotiated/billNegotiated/detail?billNegotiatedId='+row.billNegotiatedId+'" class="btnList" title="${text("查看到单押汇")}"><i class="fa fa-file-text-o"></i></a>&nbsp;');
            <% } %>
            <% if(hasPermi('financial:billnegotiated:billNegotiated:edit')){ %>
			/*actions.push('<a href="${ctx}/financial/billnegotiated/billNegotiated/form?billNegotiatedId='+row.billNegotiatedId+'" class="btnList" title="${text("编辑到单押汇")}"><i class="fa fa-pencil"></i></a>&nbsp;');*/
			actions.push('<a href="${ctx}/financial/billnegotiated/billNegotiated/delete?billNegotiatedId='+row.billNegotiatedId+'" class="btnList" title="${text("删除到单押汇")}" data-confirm="${text("确认要删除该到单押汇吗？")}"><i class="fa fa-trash-o"></i></a>&nbsp;');
			<% } %>
		return actions.join('');
		}},
		{header:'${text("车架号")}', name:'frameNumber', index:'a.frame_number', width:150, align:"left"},
		{header:'${text("品牌")}', name:'brand', index:'a.brand', width:150, align:"center", formatter: function(val, obj, row, act){
			return js.getDictLabel(${@DictUtils.getDictListJson('car_pinpai')}, val, '${text("未知")}', true);
		}},
		{header:'${text("版型")}', name:'area', index:'a.area', width:150, align:"center", formatter: function(val, obj, row, act){
			return js.getDictLabel(${@DictUtils.getDictListJson('car_quyu')}, val, '${text("未知")}', true);
		}},
		{header:'${text("车型")}', name:'model', index:'a.model', width:150, align:"left"},
		{header:'${text("价格")}', name:'unitPrice', index:'a.unit_price', width:150, align:"right", formatter: function(val, obj, row, act){
			return js.formatNumber(val, 2, false, ''); // 数值类型格式化 (原始数值, 小数位数, 是否千分位, 默认值，金额情况下设置0.00);
		}},
		{header:'${text("币种")}', name:'currency', index:'a.currency', width:150, align:"center", formatter: function(val, obj, row, act){
			return js.getDictLabel(${@DictUtils.getDictListJson('sys_bizhong')}, val, '${text("未知")}', true);
		}},
		{header:'${text("状态")}', name:'status1', index:'a.status1', width:150, align:"center", formatter: function(val, obj, row, act){
			return js.getDictLabel(${@DictUtils.getDictListJson('bill_negotiated_status')}, val, '${text("未知")}', true);
		}},
		{header:'${text("信用证")}', name:'letterCredit.letterCreditCode', index:'a.letter_credit_code', width:150, align:"left"},
		{header:'${text("服务订单")}', name:'serviceOrder.serviceOrderCode', index:'s.service_order_code', width:150, align:"left"},
		{header:'${text("委托协议")}', name:'entrustAgreement', index:'a.entrust_agreement', width:150, align:"left"},
		{header:'${text("客户")}', name:'customer.customerName', index:'c.customer_name', width:150, align:"center"},
		{header:'${text("资方")}', name:'investor.supplierName', index:'e.supplier_name', width:150, align:"center"},
		{header:'${text("外贸合同号")}', name:'foreignTradeContractNumber', index:'a.foreign_trade_contract_number', width:150, align:"left"},
		{header:'${text("保证金购汇汇率")}', name:'marginPurchaseExchangeRate', index:'a.margin_purchase_exchange_rate', width:150, align:"left"},
		{header:'${text("押汇比例")}', name:'negotiatedRatio', index:'a.negotiated_ratio', width:150, align:"left"},
		{header:'${text("押汇金额")}', name:'negotiatedAmount', index:'a.negotiated_amount', width:150, align:"right", formatter: function(val, obj, row, act){
			return js.formatNumber(val, 2, false, ''); // 数值类型格式化 (原始数值, 小数位数, 是否千分位, 默认值，金额情况下设置0.00);
		}},
		{header:'${text("开始日期")}', name:'startDate', index:'a.start_date', width:150, align:"center"},
		{header:'${text("资方结束日期")}', name:'investorEndDate', index:'a.investor_end_date', width:150, align:"center"},
		{header:'${text("客户结束日期")}', name:'customerEndDate', index:'a.customer_end_date', width:150, align:"center"},
		{header:'${text("押汇期应还款金额")}', name:'amount', index:'a.amount', width:150, align:"right", formatter: function(val, obj, row, act){
			return js.formatNumber(val, 2, false, ''); // 数值类型格式化 (原始数值, 小数位数, 是否千分位, 默认值，金额情况下设置0.00);
		}},
		{header:'${text("是否N+1")}', name:'n1Flag', index:'a.n1_flag', width:150, align:"center", formatter: function(val, obj, row, act){
			return js.getDictLabel(${@DictUtils.getDictListJson('sys_yes_no')}, val, '${text("未知")}', true);
		}},
		{header:'${text("资方押汇利息")}', name:'investorNegotiatedInterest', index:'a.investor_negotiated_interest', width:150, align:"right", formatter: function(val, obj, row, act){
			return js.formatNumber(val, 2, false, ''); // 数值类型格式化 (原始数值, 小数位数, 是否千分位, 默认值，金额情况下设置0.00);
		}},
		{header:'${text("客户押汇利息")}', name:'customerNegotiatedInterest', index:'a.customer_negotiated_interest', width:150, align:"right", formatter: function(val, obj, row, act){
			return js.formatNumber(val, 2, false, ''); // 数值类型格式化 (原始数值, 小数位数, 是否千分位, 默认值，金额情况下设置0.00);
		}},
		{header:'${text("资方本息合计")}', name:'investorTotalPrincipalInterest', index:'a.investor_total_principal_interest', width:150, align:"right", formatter: function(val, obj, row, act){
			return js.formatNumber(val, 2, false, ''); // 数值类型格式化 (原始数值, 小数位数, 是否千分位, 默认值，金额情况下设置0.00);
		}},
		{header:'${text("客户本息合计")}', name:'customerTotalPrincipalInterest', index:'a.customer_total_principal_interest', width:150, align:"right", formatter: function(val, obj, row, act){
			return js.formatNumber(val, 2, false, ''); // 数值类型格式化 (原始数值, 小数位数, 是否千分位, 默认值，金额情况下设置0.00);
		}},
		{header:'${text("实际还汇日期")}', name:'investorActualRepaymentDate', index:'a.investor_actual_repayment_date', width:150, align:"center"},
		{header:'${text("实际汇率")}', name:'investorRealExchangeRate', index:'a.investor_real_exchange_rate', width:150, align:"left"},
		{header:'${text("预估汇率")}', name:'investorEstimatedExchangeRate', index:'a.investor_estimated_exchange_rate', width:150, align:"left"},
		{header:'${text("预估价格")}', name:'investorEstimatedPrice', index:'a.investor_estimated_price', width:150, align:"right", formatter: function(val, obj, row, act){
			return js.formatNumber(val, 2, false, ''); // 数值类型格式化 (原始数值, 小数位数, 是否千分位, 默认值，金额情况下设置0.00);
		}},
		{header:'${text("还汇应付单")}', name:'investorPayableId', index:'a.investor_payable_id', width:150, align:"left"},
		{header:'${text("实际还汇日期")}', name:'customerActualRepaymentDate', index:'a.customer_actual_repayment_date', width:150, align:"center"},
		{header:'${text("实际汇率")}', name:'customerRealExchangeRate', index:'a.customer_real_exchange_rate', width:150, align:"left"},
		{header:'${text("预估汇率")}', name:'customerEstimatedExchangeRate', index:'a.customer_estimated_exchange_rate', width:150, align:"left"},
		{header:'${text("预估价格")}', name:'customerEstimatedPrice', index:'a.customer_estimated_price', width:150, align:"right", formatter: function(val, obj, row, act){
			return js.formatNumber(val, 2, false, ''); // 数值类型格式化 (原始数值, 小数位数, 是否千分位, 默认值，金额情况下设置0.00);
		}},
		{header:'${text("还汇应收单")}', name:'customerReceivableId', index:'a.customer_receivable_id', width:150, align:"left"},
		{header:'${text("创建者")}', name:'createBy', index:'a.create_by', width:150, align:"left"},
		{header:'${text("创建时间")}', name:'createDate', index:'a.create_date', width:150, align:"center"},
		{header:'${text("备注信息")}', name:'remarks', index:'a.remarks', width:150, align:"left"},
	],
	frozenCols: true,
	// 加载成功后执行事件
	ajaxSuccess: function(data){
		
	}
});
</script>